const { override, fixBabelImports, addWebpackAlias, addLessLoader } = require('customize-cra');
const path = require('path');
const theme = require('./theme.config');

// const rewireCssModules = require('react-app-rewire-css-modules');

module.exports = override(
  fixBabelImports('import', {
    libraryName: 'antd',
    style: true,
  }),
  addWebpackAlias({
    '@': path.resolve(__dirname, './src'),
    '@assets': path.resolve(__dirname, './src/assets'),
    '@components': path.resolve(__dirname, './src/components'),
    '@api': path.resolve(__dirname, './src/api'),
    '@utils': path.resolve(__dirname, './src/utils'),
  }),
  addLessLoader({
    javascriptEnabled: true,
    modifyVars: theme,
  }),
  // addPostcssPlugins(),

  (config, env) => {
    // config = rewireCssModules(config, env);
    return config;
  }
);
